package com.ve.clexer;


import com.ve.view.text.document.CommonLanguage;

public class CLanguage extends CommonLanguage {
    private final static char[] BASIC_C_OPERATORS = {
            '(', ')', '{', '}', '.', ',', ';', '=', '+', '-',
            '/', '*', '&', '!', '|', ':', '[', ']', '<', '>',
            '?', '~', '%', '^'
    };

    public final static String BASIC_TYPE_NAMES[] = {"int", "void", "char", "short", "long", "w_char", "bool", "auto", "float", "double", "unsigned", "signed"};

    public final static String[] BASIC_KEYWORDS = {
            "const", "extern", "register", "static", "volatile", "sizeof", "typedef",
            "enum", "struct", "union",
            "break", "case", "continue", "default", "do", "else", "for",
            "goto", "if", "return", "switch", "while"
    };

    public static boolean isKeyWord(String text) {
        for (String basicKeyword : BASIC_KEYWORDS) {
            if (basicKeyword.equals(text)) {
                return true;
            }
        }
        return false;
    }    public static boolean isBasicTypeWord(String text) {
        for (String basicKeyword : BASIC_TYPE_NAMES) {
            if (basicKeyword.equals(text)) {
                return true;
            }
        }
        return false;
    }

    public static boolean isOperator(char c) {
        for (char basicKeyword : BASIC_C_OPERATORS) {
            if (c == basicKeyword) {
                return true;
            }
        }
        return false;
    }
}
